home *** CD-ROM | disk | FTP | other *** search
/ 1,000+ Hot Games / 1000-Plus-Hot-Games-1999.zip / 1000+ Hot Games (1999) / PROGRAMS / CARDWS17 / INC / POKER.CDH < prev    next >
Text File  |  1994-02-06  |  1KB  |  68 lines

  1. #ifndef cwspoker
  2. #define cwspoker
  3.  
  4. {****determine si la pile (de 5 cartes) est une straight}
  5. stack predicate Straight? is
  6. var mi, ma : card,
  7.     m2, m3, m4 : boolean,
  8.     i : integer;
  9. begin
  10.   mi:=[1] mod 13;
  11.   ma:=mi;
  12.   i:=2;
  13.   while i<=5 do
  14.     begin
  15.     if mi>([i] mod 13) then mi:=[i] mod 13
  16.     else if ma<([i] mod 13) then ma:=[i] mod 13;
  17.     i:=i+1;
  18.     end;
  19.   if (ma-mi)<>4 then return FALSE;
  20.   m2:=FALSE;
  21.   m3:=FALSE;
  22.   m4:=FALSE;
  23.   i:=1;
  24.   while i<=5 do
  25.     begin
  26.     if ([i] mod 13) = mi + 1 then m2:=TRUE
  27.     else if ([i] mod 13) = mi + 2 then m3:=TRUE
  28.     else if ([i] mod 13) = mi + 3 then m4:=TRUE;
  29.     i:=i+1;
  30.     end;
  31.   return (m2 and m3 and m4);
  32. end;
  33.  
  34. {****determine si la pile (de 5 cartes) est une flush}
  35. stack predicate Flush? is
  36. var m1 : card,
  37.     i : integer;
  38. begin
  39.   m1:=([1] / 13) mod 4;
  40.   i:=2;
  41.   while i<=5 do
  42.     begin
  43.     if (([i] / 13) mod 4)<>m1 then return FALSE;
  44.     i:=i+1;
  45.     end;
  46.   return TRUE;
  47. end;
  48.  
  49. {****determine si la pile (de 5 cartes) contient deux valeur de cartes}
  50. stack predicate OnlyTwo? is
  51. var m1, m2 : card,
  52.     i : integer;
  53. begin
  54.   m1:=[1] mod 13;
  55.   m2:=m1;
  56.   i:=2;
  57.   while i<=5 do
  58.     begin
  59.     if ([i] mod 13)<>m1 then 
  60.       if m2=m1 then m2:=([i] mod 13)
  61.       else if ([i] mod 13)<>m2 then return FALSE;
  62.     i:=i+1;
  63.     end;
  64.   return TRUE;
  65. end;
  66.  
  67. #endif 
  68.